﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;

namespace Petaframe.DataAccess
{
    public interface IDataService : IDisposable
    {        
        Dictionary<string, object> OutputParameters { get; }
        IDetachedQuery DetachedQuery { get; }
        void BeginTransaction();
        void CommitTransaction();
        void RollbackTransaction();
        T FindBy<T>(string commandText = "", CommandType commandType = CommandType.Text);
        IEnumerable<T> FindAll<T>(string commandText = "", CommandType commandType = CommandType.Text);
        int Insert<T>(T item);
        int Insert(string commandText, CommandType commandType = CommandType.Text);
        int Update<T>(T item);
        int Update(string commandText, CommandType commandType = CommandType.Text);
        int Delete(string commandText, CommandType commandType = CommandType.Text);
        int Delete<T>(T item);
        object GetScalarValue(string commandText, CommandType commandType = CommandType.Text);
        PagedResults<T> Page<T>(int currentPage = 1, int pageSize = 20, string whereCommand = "", string orderByCommand = "");
        void AddInputParameter(string parameterName, object parameterValue, DbType dbType);
        void AddOutputParameter(string parameterName, DbType dbType, int parameterSize);
        void AddInputOutputParameter(string parameterName, object parameterValue, DbType dbType, int parameterSize);
    }
 
}
